﻿
using Microsoft.Practices.Unity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace UnityConsoleTutorial
{
    class Program
    {
        static void Main(string[] args)
        {
            IUnityContainer container = new UnityContainer();

            container.RegisterType<ILogger, DatabaseLogger>();
            container.RegisterType<ILogger, FlatFileLogger>("flatfileLogger");
        }
    }


    public interface ILogger
    {
        void Write(string message);
    }

    public class FlatFileLogger: ILogger
    {
        public void Write(string message)
        {
            Console.WriteLine(String.Format("Message:{0}", message));
            Console.WriteLine("Target:FlatFile");
        }
    }

    public class DatabaseLogger : ILogger
    {
        public void Write(string message)
        {
            Console.WriteLine(String.Format("Message:{0}", message));
            Console.WriteLine("Target Database");
        }
    }



}
